# centos7-ssh
FROM centos:7
MAINTAINER fenglitan "fenglitan@icloud.com"　

RUN yum install passwd openssl openssh-server -y
RUN mkdir -p /var/run/sshd
RUN ssh-keygen -q -t rsa -b 2048 -f /etc/ssh/ssh_host_rsa_key -N ''
RUN ssh-keygen -q -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ''
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key  -N ''
RUN sed -i "s/#UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config
# 设置root密码
RUN /bin/echo 'root:123456'|chpasswd
# 启动sshd服务并且暴露22端口
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]